#include"Mylist.h"
#include <iostream>
LinkList::LinkList() : head(nullptr) {
}
LinkList::~LinkList() {
    while (head) {
        Node* next = head->next;
        delete head;
        head = next;
    }
}
void LinkList::push_front(Order* value) {
    Node* newNode = new Node();
    newNode->data = value;
    newNode->next = head;
    head = newNode;
    ++num;
}
void LinkList::remove(int value) {
    Node** pp = &head;
    while (*pp) {
        if ((*pp)->data == value) {
            Node* toDelete = *pp;
            *pp = (*pp)->next;
            delete toDelete;
        }
        else {
            pp = &(*pp)->next;
        }
    }
}
void LinkList::print() const {
    Node* current = head;
    while (current) {
        std::cout << current->data << " ";
        current = current->next;
    }
    std::cout << std::endl;
}
